<!DOCTYPE html>
<html lang="en">
<head>
    <title>活动</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="/static/index/css/font-awesome.min.css" rel="stylesheet" type="text/css" media="all" /><!-- fontawesome -->
    <link href="/static/index/css/bootstrap.min.css" rel="stylesheet" type="text/css" media="all" /><!-- Bootstrap stylesheet -->
    <link href="/static/index/css/style.css" rel="stylesheet" type="text/css" media="all" />
    <link rel="stylesheet" href="/static/index/css/smoothbox.css" type='text/css' media="all" />
    <link rel="stylesheet" href="/static/index/reset.css" type="text/css">
    <link href="/static/index/js/layui/css/layui.css" rel="stylesheet">


    <!-- stylesheet -->
    <!-- meta tags -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="keywords" content="" />
    <script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
    <!-- //meta tags -->
    <!--fonts-->
    <link href="http://fonts.googleapis.com/css?family=Roboto+Condensed:300,300i,400,400i,700,700i&subset=cyrillic,cyrillic-ext,greek,greek-ext,latin-ext,vietnamese" rel="stylesheet">
    <link href="http://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
    <!--//fonts-->
    <script type="text/javascript" src="/static/index/js/jquery-2.1.4.min.js"></script>
    <script src="/static/index/js/main.js"></script>
    <!-- Required-js -->
    <!-- start-smoth-scrolling -->
    <script type="text/javascript" src="/static/index/js/move-top.js"></script>
    <script type="text/javascript" src="/static/index/js/easing.js"></script>

    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>添加活动</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="__CSS__/bootstrap.min (2).css?v=3.3.6" rel="stylesheet">
    <link href="__CSS__/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="__CSS__/animate.min.css" rel="stylesheet">
    <link href="__CSS__/style.min.css?v=4.1.0" rel="stylesheet">
    <link href="__JS__/plugins/bootstrap-tagsinput/bootstrap-tagsinput.css" rel="stylesheet">
    <link href="__JS__/layui/css/layui.css"rel="stylesheet">
    <script type="text/javascript">
        jQuery(document).ready(function($) {
            $(".scroll").click(function(event){
                event.preventDefault();
                $('html,body').animate({scrollTop:$(this.hash).offset().top},1000);
            });
        });
    </script>
    <!-- start-smoth-scrolling -->

    <!-- scriptfor smooth drop down-nav -->
    <script>
        $(document).ready(function(){
            $(".dropdown").hover(
                function() {
                    $('.dropdown-menu', this).stop( true, true ).slideDown("fast");
                    $(this).toggleClass('open');
                },
                function() {
                    $('.dropdown-menu', this).stop( true, true ).slideUp("fast");
                    $(this).toggleClass('open');
                }
            );
        });
    </script>
    <!-- //script for smooth drop down-nav -->
</head>
<body class="gray-bg">

<!-- header -->
<header>
    <div class="w3layouts-top-strip">
        <div class="container">
            <div class="logo">

                <img src="{$photo}" alt="..." class="img-circle" width="100">


                <h3><a href="#">{$username}</a></h3>

            </div>

        </div>
    </div>
    <!-- navigation -->
    <nav class="navbar navbar-default">
        <div class="container">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
            </div>
        </div>
    </nav>

    <!-- //navigation -->
</header>

<div class="breadcrumbs">
    <div class="container">
        <div class="row readcrumb breadcrumb1 animated wow fs16 cf" data-wow-delay=".5s">
            <!--<div class="col-md-1"><a href="#"><button type="button" class="btn btn-default " ><span class="glyphicon glyphicon-plus-sign">关注</span></button></a></div>-->
            <!--<div class="col-md-1"><button type="button" class="btn btn-default ">私信</button></div>-->
            <div class="col-md-1"></div>
            <div class="col-md-1"><a href="{:url('/buser')}" class="cf">主页</a></div>
            <div class="col-md-1"></div>
            <div class="col-md-1"><a href="{:url('/server')}" class="cf">服务</a></div>
            <div class="col-md-1"></div>
            <div class="col-md-1"><a href="{:url('/photo')}" class="cf">相册</a></div>
            <div class="col-md-1"></div>
            <div class="col-md-1"><a href="{:url('/bad')}" class="cf">添加广告</a></div>
            <div class="col-md-1"></div>
            <div class="col-md-1"><a href="{:url('/activity')}" class="cf">添加活动</a></div>
            <div class="col-md-1"></div>

        </div>
    </div>
</div>
<!-- //header -->
<!-- banner -->
<!-- //breadcrumbs -->
<!-- //banner -->
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-10">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>添加活动</h5>
                </div>
                <div class="ibox-content">
                    <form class="form-horizontal m-t" id="commentForm" method="post" action="{:url('activity/activity')}">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">活动标题：</label>
                            <div class="input-group col-sm-7">
                                <input id="title" type="text" class="form-control" name="title" required="" aria-required="true">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">活动描述：</label>
                            <div class="input-group col-sm-7">
                                <textarea id="description" class="form-control" name="description" required="" aria-required="true"></textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">关键词：</label>
                            <div class="input-group col-sm-7">
                                <input id="keywords" class="form-control" name="keywords">
                            </div>
                        </div>
                        <div class="form-group">
                            <label  class="col-sm-3 control-label">活动类型：</label>
                            <div class="input-group col-sm-7">
                                <select class="form-control" id="type" name="type">
                                    <option value="1">转发</option>
                                    <option value="2">抽奖</option>
                                    <option value="3">投票</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">缩略图：</label>
                            <input name="thumbnail" id="thumbnail" type="hidden"/>
                            <div class="form-inline">
                                <div class="input-group col-sm-2">
                                    <button type="button" class="layui-btn" id="test1">
                                        <i class="layui-icon">&#xe67c;</i>上传图片
                                    </button>
                                </div>
                                <div class="input-group col-sm-3">
                                    <div id="sm"></div>
                                </div>
                            </div>

                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">活动内容：</label>
                            <div class="input-group col-sm-7">
                                <script id="container" name="content" type="text/plain">
                                </script>
                            </div>
                        </div>
                        <div><input type="hidden" name="uid" value="{$uid}"></div>
                        <div><input type="hidden" name="status" value="1"></div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-8">
                                <!--<input type="button" value="提交" class="btn btn-primary" id="postform"/>-->
                                <button class="btn btn-primary" type="submit">确认提交</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>

        </div>
    </div>
</div>

<script src="__JS__/jquery.min.js?v=2.1.4"></script>
<script src="__JS__/bootstrap.min (2).js?v=3.3.6"></script>
<script src="__JS__/content.min.js?v=1.0.0"></script>
<script src="__JS__/plugins/bootstrap-tagsinput/bootstrap-tagsinput.min.js"></script>
<script src="__JS__/plugins/validate/jquery.validate.min.js"></script>
<script src="__JS__/plugins/validate/messages_zh.min.js"></script>
<script src="__JS__/layui/layui.js"></script>
<script src="__JS__/jquery.form.js"></script>
<script src="__JS__/plugins/ueditor/ueditor.config.js"></script>
<script src="__JS__/plugins/ueditor/ueditor.all.js"></script>
<!-- footer -->
<div class="footer-agile-info">
    <div class="container">
        <div class="col-md-4 w3layouts-footer">
            <h3>联系信息</h3>
            <p><span><i class="fa fa-map-marker" aria-hidden="true"></i></span>中华人民共和国上海市徐汇区</p>
            <p><span><i class="fa fa-envelope" aria-hidden="true"></i></span><a href="#">1551941489@qq.com</a></p>
            <p><span><i class="fa fa-mobile" aria-hidden="true"></i></span>P: 03765759119 </p>
            <p><span><i class="fa fa-globe" aria-hidden="true"></i></span><a href="http://www.zhc1995.cn">W:
                www.zhc1995.cn</a></p>
        </div>
        <div class="col-md-4 wthree-footer">
            <h2>网站简介</h2>
            <p>本网站纯属娱乐,如作商业用途,请联系本人</p>
        </div>
        <div class="col-md-4 w3-agile">
            <h3>意见反馈</h3>
            <p>如果您有好的提议,前邮件联系作者</p>

        </div>
    </div>

</div>
<!-- footer -->
<!-- copyright -->
<div class="copyright">

    <div class="container">
        <div class="w3agile-list">

        </div>
        <div class="agileinfo">
            <p>版权 &copy; 魔狗工作室保留一切版权<a target="_blank" href="http://www.baidu.com">魔狗工作室</a>备案号:19001432</p>
        </div>
    </div>
</div>
<!-- //copyright -->
<!-- here stars scrolling icon -->
<script type="text/javascript">
    var index = '';
    function showStart(){
        index = layer.load(0, {shade: false});
        return true;
    }

    function showSuccess(res){

        layer.ready(function(){
            layer.close(index);
            if(1 == res.code){
                layer.alert(res.msg, {title: '友情提示', icon: 1, closeBtn: 0}, function(){
                    window.location.href = res.data;
                });
            }else if(111 == res.code){
                window.location.reload();
            }else{
                layer.msg(res.msg, {anim: 6});
            }
        });
    }

    $(document).ready(function(){
        // 添加角色
        var options = {
            beforeSubmit:showStart,
            success:showSuccess
        };

        $('#commentForm').submit(function(){
            $(this).ajaxSubmit(options);
            return false;
        });

        $('#keywords').tagsinput('add', 'some tag');
        $(".bootstrap-tagsinput").addClass('col-sm-12').find('input').addClass('form-control')
            .attr('placeholder', '输入后按enter');

        // 上传图片
        layui.use('upload', function(){
            var upload = layui.upload;

            //执行实例
            var uploadInst = upload.render({
                elem: '#test1' //绑定元素
                ,url: "{:url('activity/uploadImg')}" //上传接口
                ,done: function(res){
                    //上传完毕回调
                    $("#thumbnail").val(res.data.src);
                    $("#sm").html('<img src="' + res.data.src + '" style="width:40px;height: 40px;"/>');
                }
                ,error: function(){
                    //请求异常回调
                }
            });
        });

        var editor = UE.getEditor('container');
    });

    // 表单验证
    $.validator.setDefaults({
        highlight: function(e) {
            $(e).closest(".form-group").removeClass("has-success").addClass("has-error")
        },
        success: function(e) {
            e.closest(".form-group").removeClass("has-error").addClass("has-success")
        },
        errorElement: "span",
        errorPlacement: function(e, r) {
            e.appendTo(r.is(":radio") || r.is(":checkbox") ? r.parent().parent().parent() : r.parent())
        },
        errorClass: "help-block m-b-none",
        validClass: "help-block m-b-none"
    });
</script>
<!-- //here ends scrolling icon -->

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<!--<script src="__JS__/bootstrap.js"></script>-->
</body>
</html>